package com.example.rabbitmq.util;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ConnectionUtil {
    //静态方法,需要连接对象直接调用即可！
    public static Connection getConnection() throws IOException, TimeoutException {
        //获取一个链接工程
        ConnectionFactory factory = new ConnectionFactory();
        Connection connection = factory.newConnection();
        return connection;
    }
}
